/*
 * @Author: wuqingchun
 * @Date: 2024-10-30 08:49:00
 * @Description: 
 * @LastEditors: wuqingchun
 * @LastEditTime: 2024-10-31 20:53:13
 */
#ifndef __NET_SERVER_H__
#define __NET_SERVER_H__

#include "libnet.h"
#include "net_event_select.h"

class CNetServer : public INetTCPConnectionCallback
{
public:
    CNetServer();
    ~CNetServer();

    int32_t Init(const char* pcHost, uint16_t usPort);

    int32_t Start();

public:
    virtual void OnConnected(INetTCPConnection *pobjConn) override final;
    virtual void OnDisconnected(INetTCPConnection *pobjConn) override final;
    virtual void OnMessage(const void* pData, size_t ulDataLen) override final;
private:
    CNetEventSelect m_objSelect;
    INetTCPServer* m_pobjServer = nullptr;
};

#endif //__NET_SERVER_H__